package cn.com.open.itembank.service.impl;

import cn.com.open.itembank.dto.ComposePaper;
import cn.com.open.itembank.dto.TestPaperModel;
import cn.com.open.itembank.logic.ComposePaperGeneticAlgorithm;
import cn.com.open.itembank.service.ComposePaperService;
import org.springframework.stereotype.Service;

/**
 * Created by lucky on 2018/1/24.
 */
@Service
public class ComposePaperServiceImpl implements ComposePaperService {


    /**
     * 遗传算法组卷.
     *
     * @param composePaper 组卷模型
     * @return the test paper model
     */
    @Override
    public TestPaperModel composePaperGenetic(ComposePaper composePaper) {

        ComposePaperGeneticAlgorithm algorithm = new ComposePaperGeneticAlgorithm(composePaper.getForChooseQuestionList(),
                composePaper.getMandatoryQuestionList(), composePaper.getRuleSaveModel(),
                composePaper.getQuestionIdListByTypeAndCategories(), composePaper.getQuestionTypes(), composePaper.getMutexQuestions());

        return algorithm.composePaperGenetic();
    }
}
